import {
  request
} from '../request.js';

// 微信登陆(获取临时信息)
export const wxLogin = function (data) {
  return request(`v1/mini/users/code2session`, 'POST', data);
};

// 获取手机号码
export const getPhoneNum = function (data) {
  return request(`v1/mini/users/phoneno`, 'POST', data);
};

// 获取用户信息
export const getUserInfo = function (data) {
  return request(`v1/mini/users/info`, 'GET', data);
};

// 实名认证
export const certification = function (data) {
  return request('v1/mini/users/certification', 'POST', data);
};

// 意见反馈
export const feedback = function (data) {
  return request(`v1/mini/users/feedback`, 'POST', data);
};

// 每月总计
export const getOrderStatistics = function (data) {
  return request(`v1/mini/orders/statistics`, 'GET', data);
};

// 揽收点信息列表
export const getCollections = function (data) {
  return request('v1/mini/collections', 'GET', data);
};

// 揽收点营收列表
export const LanShouPoint = function (collectionId, data) {
  console.log("collectionId", collectionId)
  return request(`v1/mini/collection/${collectionId}/statistic`, 'GET', data);
};

// 常用取票人信息列表
export const getContacts = function (data) {
  return request('v1/mini/contacts', 'GET', data);
};

// 添加常用取票人
export const addContacts = function (data) {
  return request(`v1/mini/contacts/${data.contactId}`, 'POST', data);
};

// 删除常用取票人
export const deleteContacts = function (contactId) {
  return request(`v1/mini/contacts/${contactId}`, 'DELETE');
};

// // 收件人信息列表
// export const getRecipients = function (data) {
//   return request('v1/mini/recipients', 'GET', data);
// };

// // 添加/编辑收件人信息
// export const setRecipients = function (data) {
//   return request(`v1/mini/recipients/${data.recipientId}`, 'POST', data);
// };

// // 删除收件人信息
// export const deleteRecipients = function (recipientId) {
//   return request(`v1/mini/recipients/${recipientId}`, 'DELETE');
// };



// 接口变动
// 【我的】获取收件人信息列表V2
export const getRecipients = function (data) {
  return request('v2/mini/recipients', 'GET', data);
};

// 【我的】添加或编辑收件人信息V2
export const setRecipients = function (data) {
  return request(`v2/mini/recipients/${data.recipientId}`, 'POST', data);
};

// 删除收件人信息
export const deleteRecipients = function (recipientId) {
  return request(`v2/mini/recipients/${recipientId}`, 'DELETE');
};

// 计算运费
export const postage = function (data) {
  return request('v2/mini/postage/new', 'GET', data);
};

// 获取自提点信息列表
export const getStations = function (data) {
  return request('v1/mini/stations', 'GET', data);
};

// 获取获取营收情况
export const getRevenue = function () {
  return request('/v2/mini/user/revenue/statistics', 'GET');
};

// 获取今年果农交易统计
export const tradeStatistics = function () {
  return request('/v2/mini/user/order/statistics', 'GET');
};

//获取今年果农提现记录信息列表
export const getWithdrawalRecord = function (data) {
  return request('/v2/mini/user/revenue/transactions', 'GET',data);
};

//提现
export const getwithdrawal = function (data) {
  return request('/v2/mini/user/revenue/withdraw', 'POST',data);
};

// 提交/编辑订单
export const setOrder = function (data) {
  return request(`v2/mini/orders/${data.orderId}`, 'POST', data);
};

// 获取订单列表
export const getOrders = function (data) {
  return request('v1/mini/orders', 'GET', data);
};

// 删除订单
export const removeOrder = function (data) {
  return request(`v1/mini/orders/${data.orderId}`, 'DELETE');
};

// 提交分享订单
export const submitShareOrder = function (data) {
  // return request('v2/mini/orders/share', 'POST', data);
  return request('v3/mini/orders/share', 'POST', data);
};

// 订单详情
export const getOrderInfo = function (data) {
  return request(`v1/mini/orders/${data.orderId}`, 'GET');
};

// 申请/取消退款
export const orderRefund = function (data) {
  return request(`v1/mini/orders/${data.orderId}/refund`, 'POST', data);
};

// 获取统计页面订单列表
export const getOrderList = function (data) {
  return request('v1/mini/orders/search', 'GET', data);
};

// 获取统计页面订单信息列表V2版本
export const getOrderListV2 = function (data) {
  return request('v2/mini/orders/search', 'GET', data);
};

// 订单物流详情
export const getLogistics = function (data) {
  return request(`v1/mini/orders/${data.orderId}/logistics`, 'GET');
};

// 订单结算
export const orderPay = function (data) {
  return request('v1/mini/orders/pay', 'POST', data);
};

// 获取取票码
export const getTicketcodes = function (data) {
  return request('v1/mini/orders/ticketcodes', 'GET', data);
};

// 获取取票码及京配码
export const getTicketcodes1 = function (data) {
  return request('v2/mini/orders/ticketcodes', 'GET', data);
};

// 获取自提点城市信息
export const getStationsCity = function () {
  return request('v1/mini/stations/city', 'GET');
};

// 新增/编辑投诉建议
export const addComplaint = function (data) {
  return request('v1/mini/orders/complain', 'POST', data);
};
// 富文本详情
export const getrichText = function (data) {
  return request('v1/mini/fruits/complain', 'GET', data);
};

// 获取省市区信息
export const getRegion = function (data) {
  return request('v1/common/addresses', 'GET', data);
};

// 获取寄件人列表
export const getSenderList = function (data) {
  return request('v1/mini/senders', 'GET', data);
};

// 添加编辑寄件人
export const editSender = function (data) {
  return request('v1/mini/senders/' + data.senderId, 'POST', data);
};

// 删除寄件人
export const deleteSender = function (senderId, data) {
  return request('v1/mini/senders/' + senderId, 'DELETE', data);
};

// 获取水果品种信息列表
export const getFruitList = function (data) {
  return request('v1/mini/fruits', 'GET', data);
};

// 获取揽收点  中 水果品种信息列表
export const getV2FruitList = function (data) {
  return request('v2/mini/fruits', 'GET', data);
};

// 获取首页水果品种信息列表
export const getHomeFruitList = function (data) {
  return request('v2/mini/user/index/fruits', 'GET', data);
};

// 获取首页水果揽收点详情
export const CollectionConfig = function (data) {
  return request('v2/mini/user/collection/config', 'GET', data);
};

// 获取水果品种详情
export const getFruitDetail = function (fruitId) {
  return request(`v1/mini/fruits/${fruitId}`, 'GET');
}

// 【下单】查询分公司列表
export const getCompany = function () {
  return request(`v1/mini/companies`, 'GET');
}

// 投诉建议信息列表
export const complaitDataList = function (data) {
  return request(`/v1/mini/orders/complain`, 'GET', data)
}

// 投诉建议列表详情
export const complaitDetail = function (complainId) {
  return request(`/v1/mini/orders/complain/${complainId}`, 'GET')
}
//  取消投诉建议订单
export const cancelComplain = function (complainId) {
  return request(`/v1/mini/orders/complain/${complainId}`, 'PUT')
}

//  获取运单号
export const getTranOrder = function (orderId) {
  return request(`/v1/mini/orders/${orderId}/trackingNo`, 'GET')
}

//  揽收
export const CollectList = function (data) {
  return request(`/v1/mini/orders/collection/summary`, 'GET', data)
}

// 果农端小程序2022接口

// 新的实名认证V2
export const register = function (data) {
  return request('v2/mini/users/certification', 'POST', data);
};

// 【我的】获取果农水果品种列表V2
export const myFruitList = function (data) {
  return request('v2/mini/user/fruits', 'get', data)
}
// 【我的】获取果农水果品种详情V2
export const myFruitDetail = userFruitId => {
  return request(`v2/mini/user/fruits/${userFruitId}`, 'get')
}
// 【我的】删除果农水果品种V2
export const myFruitDelete = userFruitId => {
  return request(`v2/mini/user/fruits/${userFruitId}`, 'delete')
}
// 【我的】上架下架果农水果品种V2
export const myFruitSale = userFruitId => {
  return request(`v2/mini/user/fruits/${userFruitId}/sale`, 'put')
}
// 我的】置顶取消置顶果农水果品种V2
export const myfruitTop = userFruitId => {
  return request(`v2/mini/user/fruits/${userFruitId}/top`, 'put')
}
// 【我的】新增或编辑果农水果品种V2
export const myfruitEdit = (data) => {
  return request(`v2/mini/user/fruits`, 'post', data)
}
// 【我的 - 揽收点】新增或编辑果农物流订单水果揽收配置
export const homefruitEdit = (data) => {
  return request(`v2/mini/user/collection/config`, 'post', data)
}

// 【我的 - 揽收点】新增或编辑果农物流订单水果揽收配置
export const homefruitEditV3 = (data) => {
  return request(`v3/mini/user/collection/config`, 'post', data)
}

// 【我的】获取果农可用优惠券（到期时间顺序，下单时需要锁券）
export const myCoupon = (data) => {
  return request(`v2/mini/user/coupon/select`, 'get')
}
// 【我的】优惠券列表
export const myCouponList = (data) => {
  return request(`/v1/mini/user/coupons`, 'get',data)
}
// 【我的】获取果农的用户端小程序邀请码
export const userInvitate = (data) => {
  return request(`v2/mini/user/invitation/customer/qrcode`, 'get')
}
// 【我的】获取果农的果农端端小程序邀请码
export const userInvitate1 = (data) => {
  return request(`v2/mini/user/invitation/farmer/qrcode`, 'get')
}

//【我的 - 揽收点】获取果农物流订单水果揽收配置信息列表
export const collectionConfigsList= (data) => {
  return request(`/v2/mini/user/collection/configs`, 'get')
}

export const collectionConfigsListV3= (data) => {
  return request(`v3/mini/user/collection/configs`, 'get')
}

//【我的 - 揽收点】获取果农物流订单水果揽收配置详情
export const collectionConfigsDetail = (data) => {
  return request(`v2/mini/user/collection/config`, 'get',data)
}

//【我的 - 揽收点】获取果农物流订单水果揽收配置详情
export const collectionConfigsDetailV3 = (data) => {
  return request(`v3/mini/user/collection/config`, 'get',data)
}

//【我的 - 揽收点】新增或编辑果农物流订单水果揽收配置
export const collectionConfigsEdit = (data) => {
  return request(`v2/mini/user/collection/config`, 'post', data)
}

//【我的 - 揽收点】新增或编辑果农物流订单水果揽收配置
export const collectionConfigsEditV3 = (data) => {
  return request(`v3/mini/user/collection/config`, 'post', data)
}
// 【我的 - 揽收点】删除果农物流订单水果揽收配置详情
export const collectionConfigsDelete = configId => {
  return request(`v2/mini/user/collection/config/${configId}`, 'delete')
}
// 待结算订单属性统计
export const attributeStatistics = (data) => {
  return request(`v2/mini/orders/attribute/statistics`, 'get',data)
}

// 文字识别
export const textRecognition = (data) => {
  return request('v1/mini/recipient/text/recognition', 'post', data)
}

// 揽收统计
export const collectionStatistic = (data) => {
  return request('v1/mini/collection/statistic', 'get', data)
}

// 揽收点详细
export const collectionInfo = () => {
  return request('v1/mini/collection/info', 'get', {})
}
// ******************************************调度员*************************************
 // 站点详细
export const craet_zhandian = () => {
  return request('v1/mgmt/tasks', 'get', {})
}